package com.bilibili.server.repository;

import com.bilibili.server.entity.VideoDetail;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.Optional;

@Repository
public interface VideoDetailRepository extends JpaRepository<VideoDetail, Long> {
    Optional<VideoDetail> findById(Long id);
    Page<VideoDetail> findByStatus(Integer status, Pageable pageable);
    Page<VideoDetail> findByCategoryIdAndStatus(Integer categoryId, Integer status, Pageable pageable);
    Page<VideoDetail> findByStatusOrderByViewCountDesc(Integer status, Pageable pageable);
    Page<VideoDetail> findByStatusOrderByCreatedAtDesc(Integer status, Pageable pageable);
}
